package com.longcai.piaojia.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;

import com.longcai.piaojia.R;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

/**
 * Created by Administrator on 2016/2/24.
 */
public abstract class PictureDialog extends BaseDialog {

    public PictureDialog(Context context) {

        super(context);

        setContentView(R.layout.dialog_picture);

        View.OnClickListener onClickListener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (v.getId()) {

                    case R.id.picture_camera:

                        onCamera();

                        break;

                    case R.id.picture_album:

                        onAlbum();

                        break;

                }

                dismiss();

            }

        };

        findViewById(R.id.picture_camera).setOnClickListener(onClickListener);

        findViewById(R.id.picture_album).setOnClickListener(onClickListener);

        findViewById(R.id.picture_cancel).setOnClickListener(onClickListener);

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) findViewById(R.id.lLayout_picDialog));
        getWindow().setGravity(Gravity.BOTTOM);

    }

    protected abstract void onCamera();

    protected abstract void onAlbum();

}
